//
//  AEPointsMallViewModel.m
//  AESOLAR_IOS
//
//  Created by Bin Tang on 2024/10/13.
//  Copyright © 2024 Mr.Wang. All rights reserved.
//

#import "AEPointsMallViewModel.h"
#import "AE_Solar-Swift.h"

@implementation AEPointsMallViewModel

- (void)initialize {
    [super initialize];
    
    self.title = [AEStringExten localizedValueWithKey:@"积分商城"];
    
    self.userInfoModel = [AEAppDelegateTool sharedInstance].userInfoModel;
    
    self.itemSize = CGSizeMake(kRealValue(166), kRealValue(240));
    
//    [self.dataList addObject:@"1"];
//    [self.dataList addObject:@"1"];
//    [self.dataList addObject:@"1"];
//    [self.dataList addObject:@"1"];
//    [self.dataList addObject:@"1"];
//    [self.dataList addObject:@"1"];
//    [self.dataList addObject:@"1"];
}

/// 获取商品列表
/// - Parameter completion: completion description
- (void)requestWithProducts:(RequestCompletionBlock)completion {
    @weakify(self);
    AEProductListRequest *request = [[AEProductListRequest alloc] init];
    [request startWithCompletionBlockWithSuccess:^(__kindof TYZBaseRequest * _Nonnull request) {
        @strongify(self);
        EDSRespondDataEntity *respond = request.responseModelObject;
        if (respond.code == EDS_NETWORK_SUCCESS) {
            [self.dataList removeAllObjects];
            [self.dataList addObjectsFromArray:respond.data];
        }
        [self sendResponseObject:request.responseModelObject completion:completion];
    } failure:^(__kindof TYZBaseRequest * _Nonnull request) {
        @strongify(self);
        [self sendResponseObject:request.responseModelObject completion:completion];
    }];
}


@end
